package com.qiantu.phone.utils;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.qiantu.phone.bean.RecommendSceneBean;

import java.util.List;

public class RecommendSceneParseUtil {

    private static String jsonDataStr;

    public static List<RecommendSceneBean> parseData(Context context) {
        if(jsonDataStr == null){
            jsonDataStr = new GetJsonDataUtil().getJson(context, "SceneRecommendData.json");//获取assets目录下的json文件数据
        }
        List<RecommendSceneBean> recommendSceneBeanList = new Gson().fromJson(jsonDataStr, new TypeToken<List<RecommendSceneBean>>() {}.getType());
        return recommendSceneBeanList;
    }

    public static void clearData(){
        jsonDataStr = null;
    }
}
